home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-0012
/
manual.doc
< prev
next >
Wrap
Text File
|
1997-04-16
|
30KB
|
603 lines
07200000208800
1
2page #
F0000000
9[...................................................]011
ü
ëPALETTEMASTER
Ç
ByKevinCowtan
êCONTENTS
Ç
ü 1.Ç Introduction.
ü 2.Ç GettingStarted.
2.1 DrawingFacilities.
2.2 ColourSelection.
2.3 OtherFacilitiesü
3.Ç AdvancedGraphics.
ü 4.Ç Programmers'Guide.
Ç
ü1.ÇêINTRODUCTION
Ç
ArtprogramsarenowfairlycommonontheAtariST,and
thereisacompetitionbetweenvariouscompaniestowritetheart
programwiththegreatestrangeoffacilities.However,in
general,apicturewhichcanbedrawnononeartprogramcanalso
bedrawnonalltheothers,althoughitmaybeeasierormore
difficultdependingonthefacilitiesprovided.PaletteMasteris
different.WithPaletteMasteryoucandrawpicturesthatare
beyondthescopeofotherprograms,orevenloadexisting
picturesandimprovethem.
PaletteMasterisuniqueinthatitallowsyoutodraw
picturesusingmorethantheST'susuallimitof16colourson
thescreenatonetime.Thismeansthatartistscannowproduce
picturesontheSTfarsuperiortothosepreviouslyavailable.
Thesepicturescanthenbeusedinotherprograms,orjustshown
asworksofcomputerart.Inadditiontomakingpicturesmore
colourful,specialgraphicstechniquesallowpicturestobe
improvedinotherways.
Howmanycolourscanyouuseonthescreen?Theoretically,
PaletteMasterallowstheuseofalloftheST's512colourson
thescreenatonce,howevertheprogramisnotwithout
limitations.Theactualnumberofcolourswhichcanbeusefully
usedinapicturegenerallyvariesbetweenabout20and50.The
limitationisthatonly16colourscanbedisplayedonanyscreen
line(ormoreaccurately,anypairofscreenlines).
Whataretheeffectsofthislimitation?Consideraland⑨
scapepicture.Atthetopofthescreentheskyisblue,fading
towardswhiteatthehorizon.Inthebackgroundtherearehills,
andintheforegroundaretreeswiththeirtopssilhouetted
againstthesky.Nowsupposeweuse5shadesofblue/whitefor
thesky.Tofadetowhitewecolourhorizontalbandsofskyin
progressivelylightercolours,andshadetheedgesofthebands
together.Thiswillonlyusetwocoloursatmostonanyscreen
line,astheworstpossiblesituationisalinewheretheedges
oftwobandsareshadedtogether.Thisleavesuswiththeborder
colour,and13shadesofgreenandbrownforthetreetops.Ifwe
wantedcloudsinthesky,4orsoofthesecolourscouldbe
allocatedforthatpurpose.
Furtherdownthescreen,thehillsappearbetweenthetrees.
Wecanusecolourfortheborder,1colourfortheskybetween
thehills,6coloursforthehillsthemselves,and8coloursfor
thetreesintheforeground.Belowthisthebackgroundcomes
towardstheobserver,andthiscanberepresentedbyprogressi⑨
velylightercoloursfortheground.Atthebottomofthescreen,
15colourscanbeallocatedfortheground,theplants,andthe
treetrunks.
Asdescribedabovethispicturewillprobablyuseatleast
30colours.Withsometouchingup,itcouldeasilyuse40or50,
agreatimprovementonthenormal16.
Ç Iftheartisthadtoconsidereverypicturelikethis,then
drawingusingPaletteMasterwouldbecomeverylaborious.However
nosuchconsiderationisrequired.PaletteMasterhasbeen
writtenspecificallytodoallthesetasksautomatically,sothat
alltheartistneeddoispickoneofthe512coloursanddraw
withit.Theallocationandarrangementofcoloursinthepicture
isalldonebyaroutinecalledthe'AutomaticPaletteManager'
(APM).Asaresultthepackageisextraordinarilysimpletouse,
moresoperhapsthaneventhemoreconventionalartprograms
availablefortheST.
Thebestwaytolearntousethepackageistouseit,so
loaduptheprogramandgothroughthe'GettingStarted'section
ofthismanualtryingoutalltheoptions.
9[...................................................]011
Çü2.ÇêGETTINGSTARTED
Ç
TousePaletteMaster,youwillneedanAtari520ST/STM/STFM
a1040STF,oraMegaST.YouwillalsoneedaTVorcolour
monitor.
PutthePaletteMasterdiskinthediskdrive,andturnon
yourmachine.TheGemdesktopshouldappear,withawindow
showingthefilesonthedisk.Doubleclicktheprogramicon
labelled'_PALART.PRG'.Theartprogramwillnowloadfromdisk.
Thescreenwillnowturnblack,andamenuoficonswillbe
drawnatthebottomofthescreen.Thisisthemenubar,andthis
particularsetoficonsiscalledtheMainMenu.Theicons,from
lefttoright,represent:
1. Apaintbrush.
2. Aspraycan.
3. Alinebeingdrawnbyacrosshaircursor.
4. Anellipse.
5. Acanofpaint,forfillinginadrawing.
6. Alettert,fortext.
7. Ablockofpicturebeingmoved.
8. Amagnifyingglass,fordetailedwork.
9. Adisk,forsavingorloadingpictures.
Thelastboxshowsyouwhichcolourisselectedatthe
moment,calledtheworkcolour.Anydrawingyoudoonthescreen
willappearinthiscolour.
Youwillnoticethattheboxcontainingthepaintbrushis
litupatthemoment.Thepaintbrushisthereforetheselected
option.Ifyouclickoneoftheothericons(i.e.pointthemouse
atitandpresstheleftbutton),thatwillbecometheselected
option.Tryselectingsomeoftheothericons.Thenselectthe
brushagain.
Tousethecurrentoption,allyouhavetodoisclickthe
mouseattheareaabovethemenubar.Ifyouhadthebrush
selected,youwillhavearoundmousecursoronthescreen.Press
theleftmousebutton.Ifyounowmovethemouseyouwillsee
thatithasleftaroundblobonthescreenintheworkcolour.
Ifyouholddowntheleftmousebuttonandmovethemouse,it
willleaveatrailofcolourbehindit.Thisishowyoudrawwith
thebrush.
Nowpresstherightmousebutton.Themainmenuwill
reappearatthebottomofthescreen.Thebrushshouldstillbe
selected,butthistimeclickitagain.Themainmenuwillbe
replacedbytheBrushMenu.Ontheleftisthebrushicon,to
showyouwhichmenuyouarein.Ontherightistheworkcolour.
Inthemiddleare16brushes,ofdifferentshapesandsizes.The
largeroundbrushontheleftisselected.Clickanotherbrushto
selectit,andthenclickthescreentodrawwithit.
Ifyoupresstherightbuttonfromamenu,thecolour
selectorscreenwillappear.Thiswillbeexplainedlater,so
presstherightbuttonagaintogettothedrawingscreen,and
oncemoretogetbacktothemainmenu.
Youcanclickanyicontoselectit,butifyouclickthe
currentlyselectediconaspecialmenuforthaticonwillappear,
(ifoneexists).Clickthemainscreentodraw,andtheright
buttontomovetothemenu,thecolourselector,andbacktothe
drawingscreeninturn.Alltheoptionscanbeusedinthisway,
andinthenextsectiontheyarelistedwiththeirpurposeand
theirsub-menus.
Ç
ü2.1ÇêDRAWINGFACILITIES
Ç
êBrushÇ: Whentheleftbuttonispressedthebrushdrawsonthe
screen.Thebrushsub-menuallowsyoutoselecttheshape
andsizeofthebrush.
êSprayÇ: Whentheleftbuttonishelddownthisoptionwill
paintonthescreenlikeanairbrush.Thespraysub-menu
allowsyoutoselecttheradiusinpixelsofthespray,and
howfastthesprayfillsanarea.1isslowand3isfast.
êLineDrawÇ: Thelinedrawingoptionwilldrawastraightline
betweentwopointsonthescreen.Pointthecrosshairatthe
startpositionandclicktheleftbutton.Nowmovethemouse
towhereyouwantittoend.Alinewillbedraggedout
joiningthepoints.Clicktheleftbuttontodrawtheline,
ortherightbuttontocancelit.Thereisnosubmenufor
linedrawing.
êEllipseÇ: Thisoptionwilldrawacircleorellipseonthe
screen.Clickwhereyouwantthecentretobe,andthenmove
themouseawayfromthispointtodrawanellipse.Click
whenitistherightshape,orpresstherightbuttonto
cancelit.
êPaint(Fill)Ç: Thisoptionisusedforfillinginanenclosed
areawiththeworkcolour,orwithamixtureofthework
colourandtheshadecolour,whichwewillcometolater.To
usethefillcan,justclicktheinteriorofanenclosed
shape,anditwillbefilledwithcolour.Thefillsub-menu
showstwocoloursontheright,theworkcolourandthe
shade colour.Inthemiddleisaselectionof8shading
patterns.Clickanyoneofthesetoselectit.
üNote:ÇThefilloptionwillnotfillinanyshapewithshade
ifitisalreadyfilledwitheithertheworkcolourorthe
shadecolour.Youwillhavetofillitwithanothercolour
first.
êTextÇ: Thisoptionallowsyoutoputtextonyourpicture.To
useitpointthecrosshairatwhereyouwantthebottom
left-handedgeofthefirstcharactertobegin.Aline
cursortheheightofthelettersyouareusingwillappear.
Typeyoutextonthekeyboardnormally.Backspacewilllet
youstartagain,undowilltakeyoubacktothecrosshair
mode,andreturnwillputthetextpermanentlyonthe
screen.Thetextsub-menuwillallowyoutoselectoneof
sixtextheights,giveninpixels.Theä'iÇ'andü'bÇ'icons
willselectäitalicÇandüboldÇmodesrespectively.
êBlockMoveÇ: Thisoptionallowsyoutocutarectangularblock
outofthepictureandtopasteitsomewhereelseonthe
screen.Touseitpositionthecrosshairatonecornerof
theblockyouwishtocut,thenpressandholddowntheleft
button.Movethemousetotheoppositecorneroftheblock
youwanttomove,andthenreleasethebutton.Anoutlined
rectanglewillthenallowyoutopositiontheblockonthe
screen.Presstheleftbuttontopastetheblockorthe
rightbuttontoreturntoblockcutmode.Notethatifyou
returntothemenuwithoutcuttinganewblock,theoldone
willbepreserved,andnexttimeyouusetheblockmove
facilityyouwillautomaticallygointoblockpastemode.
Thisallowsanotherpicturetobeloaded,andablockfrom
onepicturetobepastedontoanother.
Therearetwomodesforblockmove:normalandtranspa⑨
rent.Transparentmodeisselectedonloadingtheprogram,
butyoucanswitchtonormalmodebyclickingtheblockicon
whenitisselected.Theiconwillreflectthisselection.
Innormalmode,ablockispastedintoplaceis
identicaltotheoriginalblock.Intransparentmode
however,anypartofablockthatisdrawnintheborder
colourwillbetransparentinthepasteoperation.Whatwas
onthescreenfirstwillshowthroughtheseareasofthe
block.Thisisusefulformovingnon-rectangularpictures
aboutthescreen.
êMagnifyÇ: Thisoptionwillenlargeasmallareaofscreenfor
detailedwork.Touseitpositiontherectangleoverthe
areaonwhichyouwanttoworkandpresstheleftbutton.
Theareaintherectanglewillbeenlargedfourtimes.You
candrawonthescreeninthecurrentworkcolourusingthe
leftbutton,orreturntothenormalscreenwiththeright
button.Thereisalsoashortcuttothecolourselector
screenbyclickingthemenubar.Thereisnomagnifysub-
menu.
êDiskAccessÇ: Thisoptionhasnoeffectonthescreen,however
youcanselectthesub-menu.Thefirstoptiononthedisk
menu,thepartiallyshaderectangle,isaclearscreen
facility.Itwillerasethedrawingscreenandsetthe
bordertoblack.
Thenextthreeoptionsareforloadingpicturesfrom
disk.Theywillload.NEO,.PI1,and.ARTfilesrespecti⑨
vely.The.NEOand.PI1formatsareforloadingpictures
generatedbyothergraphicsprograms,and.ARTisaspecial
formatusedforPaletteMasterpictures.
Ifyouclickoneoftheseoptionsyouwillbepresented
withtheItemSelectorwindow.Youcanpickafiletoload
eitherbytypingitsname,orbyclickingonitsnameinthe
diskcatalogue.Pressreturnorclickon'OK'toloadthe
file.Thenclickonthescreenandthepicturewillappear.
Thelasttwooptionsonthismenuareusedtosave
picturesin.ARTand.PRGformatsrespectively.The.ART
formatismostusefulasyoucanreloadandmodifypictures
storedinthisformat.The.PRGformatisanextraoption
whichallowsfinishedpicturestobesavedasprogramfiles
whichcanthenberundirectlyfromtheGEMdesktop,orfrom
otherprograms.
Selectthefilenametosaveusingthefileselectoras
before.Youwillusuallywanttotypeinanewfilenamewhen
savingpictures,otherwiseyouwilleraseanexisting
picture.
9[...................................................]011
Ç
ü2.2ÇêTheColourSelectionScreenÇ
Thisscreencanbereachedeitherbypressingtheright
buttonfromamenuscreen,orbyclickingtheenlargescreenmenu
bar.
OntheleftofthescreenyouwillseetheST'spaletteof
512colours.Youcanmakeanyoneoftheseintotheworkcolour
simplybypointingthemouseatthecolourandpressingtheleft
button.
Ontherighthandsideofthisscreenthereareother
facilitiesavailable.Atthetopisaboxcontainingthecurrent
workcolour,whichcanbechangedasdescribedabove.Belowthis
isaboxwhichtellsyoutheRGBvaluesoftheworkcolour.These
describeonascaleof0-7howmuchred,greenandblue
respectivelythereisintheworkcolour.
Belowthisare4iconswhichaffectcolourchoice.Theyare:
SetScreenBorder PickColourfromScreen
Optimisepalettes PickcolourfromAPMpalettes
The'Setscreenborder'iconwillsetthescreenborder
colourtothecurrentworkcolour.Thiswillnotshowuponthe
palettescreen,butchangestheborderaroundtheedgeofthe
pictureonthemaindrawingscreen.
The'Pickcolourfromscreen'iconallowsyoutopicka
colourfromthosealreadyusedonthescreen.Youwillbeshown
themaindrawingscreen.Clickonthecolouryouwanttoselect,
orpresstherightbuttontoreturntothecolourselection
withoutchoosingacolour.
The'Optimise'iconwilltelltheAutomaticPaletteManager
tooptimisethesetofcoloursusedonthescreen.Itexamines
thescreenpictureandworksoutwhichcoloursareusedoneach
line.Anyunusedcoloursareflaggedasunallocatedcolours.In
generalyouneedonlyclickitafterloading.NEOor.PI1files.
The'Pickfrompalettes'iconallowsyoutopickacolour
fromthescreenjustliketheoptionaboveit,howeveritalso
displaystheAPMpalettesdowntherighthandsideofthescreen.
Eachverticalbandrepresentsoneofthe16coloursavailableon
anyscreenline.Lookatthisoptionafterdrawingonthescreen,
andyouwillseethattheAPMbuildsupcoloursfromrightto
left(colour16tocolour1).Thewhitebands(orblackbands
againstalightborder)representunallocatedcolours.The
programwillnotallowyoutoselectoneofthese.
Atthebottomofthiswindowisaboxcontainingthefill
shadingcolour,whichismixedwiththeworkcolourwhenusing
theshadedfillfacility.Ifyouclickthisbox,thenthecurrent
workcolourbecomesthefillshadingcolour.
êRUNNINGOUTOFCOLOURS
Ç Ifatanytimeyoutrytousemorethan16coloursona
screenline(orpairoflines),thenthecomputerwillringa
belltowarnyou.Itwilldrawasmuchitcan,butwillnot
modifythoselinesonwhichnocoloursareavailable.Sometimes
themousecursorchangescolour,andthismaybeawarningthat
youarerunningoutofcolours.
Toavoidthissituation,trytore-usecoloursasoftenas
possiblebyusingthe'pickfromscreen'optiondescribedabove.
ü
2.3ÇêOTHERFACILITIES
Ç
Therearetwoadditionalfacilitiesavailabletomakethe
programeasiertouse.Theseare:
êUndoÇ: IfyoupresstheUndokey(abovethecursorkeys)
whilstinanydrawingmode,theneverythingyouhavedonetothe
screensinceyoulastusedamenuwillbeerased.Thiscanbe
usedforerasingmistakes.Thisfunctionisnotavailablewhilst
thescreenisenlargedandbehavesslightlydifferentlyintext
mode.Howeveritcanbeusedwhilstpositioningtheenlargebox.
êHelpÇ: IfyoupresstheHelpkeywhilstinanydrawingmode
exceptblockmoveorenlarge,thentheareaofscreenaboutthe
cursorwillbemagnified.Pressingtheleftbuttonwillthen
executetheselecteddrawingfacilityatthepixelpointedtoby
themouse.Therightbuttonwillreturntothenormaldrawing
screen.Inthismanneritispossibletopositionthemouse
accuratelyfordrawing.Thisfacilityisusefulforfilling
smallshapes,oraccuratelycenteringellipses,orjustfor
checkingyourwork.
Ç
ü3.ÇêADVANCEDGRAPHICS
Ç
Thissectionwilltrytomakesomesuggestionsabouthowto
getthebestfromPaletteMaster.
Thefirstthingyoucandotoproducebetterpicturesisto
lookforpictureswithhorizontaldivisions,likethesimple
landscapedescribedintheintroduction.Theprogramonly
allows16coloursonanyoneline,howeverifthepictureis
dividedintohorizontalregionsthendifferentsetsofcolours
canbeusedforeachregion.ThisiswhatPaletteMasterdoes
best,althoughitcaninvariablyimproveotherpicturesaswell.
Secondly,don'tjustaddcolourstoexistingpictures
becausetheyareavailable.Usetheextracoloursfor'touching
up'smallareasofthepicture.Inthiswayitiseasytouse
morethan50coloursinapictureandobtainamuchmorerefined
result.Aparticularapplicationofthisisatechniquecalled
'edgesoftening',amethodbywhichextracolourscanbeusedto
makeapictureappeartobedrawninamuchhigherresolution.
Whenadiagonallineisdrawonthescreenitappears
jagged,owingtothelimitsoftheST'sresolution.However,we
canfooloureyesintoseeingasmoothedgebyfillinginthe
stepsinadiagonallinewithanintermediatecolour,i.e.one
withRGBvalueshalfwaybetweentheRGBvaluesofthecolours
eithersideoftheedge.Formoreeffectiveresultsseveral
colourscanbeused.Thistechniquehasbeenusedonthedemo
picture'DISCS.ART'.Thediscsintherighthalfofthepicture
havebeen'edgesoftened'.Examinethemwithenlargemodeandyou
willsoongettheidea.
ThistechniquehaslittleapplicationoutsidePaletteMaster
becausetherearenotenoughcoloursavailable.However,with
PaletteMasteritcanbeusedtogreateffect.
9[...................................................]011
Ç
ü4.ÇêPROGRAMMERS'GUIDE
Ç
Thefollowingfacilitiesareprovidedfortheuseof
PaletteMasterpicturesinyourownprograms:
1. Picturesmaybesavedas.PRGfiles,whichyoucanthenuse
frommachinecodewiththeGEMDOSfunctionEXEC.Someversionsof
Chaveafunction'loadex'whichwillloadandexecutea.PRG
filewithouterasingtheexistingprogram.Eitherofthesewill
loadanddisplayapictureuntilakeyispressed,whencontrol
shouldbereturnedtotheoriginalprogram.
2. Thefile'_PALHBL.USE'canbeusedbyassemblycode
programmerstodisplaypictures.Itcontainstheinterrupt
routinesusedbyPaletteMastertochangethescreenpalette.
ThisshouldallowyoutousePaletteMasterpicturesas
backgroundsforanimation,oryoucanusetheroutinesfor
completelydifferentpurposes.
Tousethisfile,loaditwiththeGEMDOSfunctionsOPEN,
READ,andCLOSE.TheninassemblycodeexecuteaJSRinstruction
tothefirstaddressinthefile.Thiswillsetupthe68000
traps3-10tocontroltheroutine.UnliketheGEMtraps,
parametersarepassedinregisters.Thetrapsbehaveasfollows:
êTRAP #3Ç: Enabletheinterruptroutines.TheGEMverticalblank,
keyboard,andtimerCinterruptsaredisabled.ThePaletteMaster
VBL,paletteswitching,andkeyboardinterruptsareenabled.
Whilepaletteswitchingisenabledyoushouldavoidall
supervisorcallsexceptthosetotheseroutines.Inparticular
thosecallsdependingontheaboveinterruptswillcrashthe
computer,andmostGEMcallswillbeunusable.
êTRAP #4Ç:Disabletheinterruptroutines.ThisrestorestheGEM
interruptstothestatetheywereinbeforetheTRAP#3.
êTRAP #5Ç: Changethecurrentscreenandmulti-paletteaddresses.
Thisallowsapictureanywhereinmemorytobeviewed,aslongas
itstartsona256-bytepageboundary.Thenewscreenbase
addressispassedinA1,andthemulti-paletteaddressinA2.The
constructionofmulti-palettesisexplainedlater.Ifyouloadan
.ARTfile,A1shouldbesettothebaseaddressofthefile,and
A2tothisaddress+32768.
êTRAP #6Ç: Turnonthemousecursor.Themousecursorwillappear
onthescreenandcanbemovedbymovingthemouse.Themouse
cursorwillinitiallybeoff.
êTRAP #7Ç: Turnoffthemousecursor.Themousecursorwill
disappear.Notethattomakethemousere-appearitmustbe
turnedononceforeachtimeitwasturnedoff.
êTRAP #8Ç: Changethemousecursor.Theaddressofthenewmouse
cursorispassedtotheroutineinA1.Thisregistershouldpoint
toastandardGEMspritedefinitionblock,asusedbythe$A00C
and$A00Dopcodes.
Ç
êTRAP #9Ç: Returnthekeyboardpointers.Callingthisroutinewill
returntwoparametersintheaddressregisters:
A0: Thisisthepointertoakeyboardtable.Thebytesof
thistablecontainthescancodes(nottheasciicodes)ofkeys
currentlypressedintheorderthatthewerepressed.Thetable
isterminatedby$ff.Ifthisvalueisthefirstbyteinthe
tablethennokeysarecurrentlypressed.Youcanacknowledgea
keybyreplacingitwith$ffifyoudon'twantittobedetected
again.
A1: Thisisapointertothemousetable,whichcontains
threewords.Thefirsttwocontainthemousexandycoordinates
respectively.Bit0ofthethirdwordcontainstherightbutton
status,andbit1theleft.
A2isalsochanged.
êTRAP #10Ç: Playalistofsounds.Apointertoasoundstringis
passedinA1.Thissoundstringshouldhavethesameconstruction
astheXBIOSsoundprimitive,exceptthatcodes128and129are
notimplemented.
êTRAP#11Ç: Restorethestatusregister.Ifyoumustmakeacallto
asupervisorroutinethatdoesnotdependontheGEMinterrupts,
thenfollowingitwiththiscallêmayÇpreventproblems.
Notethatapartfromtraps3and4,thesecallsonlycorruptA0.
êMULTI-PALETTESÇ
Amulti-palettehasthefollowingconstruction:
Thefirst32bytesshouldcontainthe16colourstobeused
atthetopofthescreen.
Subsequentblocksof32bytescontainawordwiththeline
onwhichthenextpalettechangeshouldoccur(from1-199),
followedbythenewcolourvaluesforcolours1to15.
Aterminationvalueof$ffffshouldfollowthefinalblock.
Youshouldnotattempttochangethepaletteontwoadjacent
screenlines,astherewillnotenoughtimeforkeyboard
interruptstooccur,possiblycausingacrash.
Ifonlytheinitialpaletteandterminationvalueare
includedintheblock,thenthepaletteswitchinginterruptwill
notbeenabled,sotheroutinegivenbelowwillnotwork.Sucha
multi-paletteisdefineduntilyouenableanewonewithTRAP#5.
PaletteMaster.ARTfilesusethefollowingmulti-palette
format.Thetop-of-screenpaletteisfollowedbyanewpalette
foreachevennumberedscreenline,i.e.therenewpalettesfor
lines2,4,6,8....198.Thereforean.ARTfilemulti-palettetakes
up322bytes,includingterminationvalue.PaletteMaster
picturesusethecoloursindescendingorderstartingwithcolour
15,soifyouwanttousecoloursforspritessetcolours1,2,3
etcfromassemblycodeineachlineonwhichthespriteistobe
used.
êWAIT-FOR-VERTICAL-BLANKÇ
Theroutinegivenbelowwillwaitforaverticalblank
interrupt.Itcanbecalledfromusermode,aslongasamulti-
palettewithatleastonepalettechange(inadditiontothe
initialpalette)isinuse.
waitvbl move.w sr,d7
btst #9,d7
beq.s waitvbl
waitvbl2move.w sr,d7
btst #9,d7
bne.s waitvbl2
rts
êEXAMPLEPROGRAM
Ç Toclarifythissectionanexampleprogramisprovided;
'_EXAMPLE.PRG'whichloadsthepicture'_DISCS.ART'anddisplays
itonthescreenwiththemousecursoruntilakeyispressed.
Theassemblycodeforthissimpleprogramisincludedbelow:
section example
* * * * * * * * * *
start move.w #2,-(sp) ; find current base of screen
trap #14
addq.l #2,sp
lea gemscrn,a0 ; and store it
move.l d0,(a0)
lea filenm1,a4 ; load _PALHBL.USE
move.l #$60000,a5
move.l #$800,a6
bsr.s open
jsr $60000 ; set up traps
lea filenm2,a4 ; load DISCS.ART
move.l #$68000,a5 ; address
move.l #$9000,a6 ; length
bsr.s open
trap #3 ; enable routines
move.l #$68000,a1 ; base of picture
move.l #$70000,a2 ; base of multi-palette
trap #5 ; show picture
trap #6 ; turn on mouse
trap #9 ; get keyboard pointers
waitkey tst.b (a0) ; wait for a key
bmi.s waitkey
done move.l gemscrn,a1 ; restore gem screen and
lea default,a2 ; a one line palette
trap #5
moveq #-1,d0 ; wait for a while until
waitpal dbra d0,waitpal ; for new palette to appear
trap #4 ; disable routines
clr.w -(sp) ; end program
trap #1
Ç* * * * * * * * * *
open clr.w -(sp) ; open picture file
move.l a4,-(sp) ; a4 -> filename
move.w #$3d,-(sp)
trap #1
addq.l #8,sp
tst.w d0
bmi.s diskerr
move.w d0,-(sp) ; store file handle
read move.l a5,-(sp) ; read pic to data area
move.l a6,-(sp)
move.w d0,-(sp)
move.w #$3f,-(sp)
trap #1
add.w #12,sp
close move.w #$3e,-(sp) ; close pic file
trap #1 ; handle already on stack
addq.l #4,sp
diskerr rts
* * * * * * * * * *
picbase dc.l 0
gemscrn dc.l 0
filenm1 dc.b 'A:_PALHBL.USE',0
filenm2 dc.b 'A:DISCS.ART',0
default dc.w $777,$700,$070,$770,$007,$707,$077,$555
dc.w $333,$733,$373,$773,$337,$737,$377,$000
dc.w -1
* * * * * * * * * *
end